{% extends "../base.html" %}

{% block title %}Roles{% endblock %}
{% block header %}Roles{% endblock %}

{% block content %}
    <a href="/projects">Projects</a>/
    <a href="/editProjectForm?projectId={{ project.key }}">Project</a>
    
    <table cellpadding="0" cellspacing="0" class="list">
    	<thead>
    		<th>Name</th>
    		<th>Can edit project</th>
    		<th>Can assign tasks</th>
    		<th>Can be assigned</th>
    		<th>Action</th>
    	</thead>
    {% for role in roles %}
        <form id="delete-form-{{ role.key }}" method="post" action="/deleteRole" >
            <input type="hidden" name="roleId" value="{{ role.key }}"></input>
        </form>
        <tr> 
            <td><a href="/editRoleForm?roleId={{ role.key }}">{{ role.name }}</a></td>
            <td>{% if role.canEditProject %} Yes {% else %} No {% endif %}</td>
            <td>{% if role.canAssign %} Yes {% else %} No {% endif %}</td>
            <td>{% if role.canBeAssigned %} Yes {% else %} No {% endif %}</td>
            <td>    
                 <a href="#" onclick="document.getElementById('delete-form-{{ role.key }}').submit()">Delete</a>
	        </td>
        </tr>
    {% endfor %}
    </table>
    
    <a href="/createRoleForm?projectId={{ project.key }}">Add role</a>
{% endblock %}
